//
// Created by Kai Wang on 2023/12/12.
//

#ifndef OPENCOS_ORDER_COMMENT_H
#define OPENCOS_ORDER_COMMENT_H

#include <chrono>
#include <string>
#include <string_view>
#include <vector>

#include "item/item_comment.h"

using time_point = std::chrono::system_clock::time_point;

class OrderComment
{
public:
    OrderComment() = default;

    [[nodiscard]] time_point get_comment_time() const;

    void set_comment_time();
    void set_comment_time(const time_point &comment_time);

    // add a new comment
    void add_comment(Item &item, float mark, std::string &comment);
    // set new comment
    void set_order_comment(
        std::string              &order_comment,  //
        std::vector<Item>        &items,          //
        std::vector<std::string> &item_comments,  //
        std::vector<float>        marks           //
    );
    // get all item
    std::vector<ItemComment> &get_item_comments();

    // get this order comment
    std::string &get_order_comment();

private:
    // time
    time_point comment_time_;
    // comment for items
    std::vector<ItemComment> item_comments_;
    // this order comment
    std::string order_comment_;
};

namespace Convert
{
/**
 * @LastEditors: Even
 * @Date: 2023-12-29 03:48:36
 * @Description:
 * @param {OrderComment} &pVal
 * @param {string} &pStr
 */
void String2OrderComment(const OrderComment &pVal, std::string &pStr);
/**
 * @LastEditors: Even
 * @Date: 2023-12-29 03:48:50
 * @Description:
 * @param {string} &pStr
 */
std::string OrderComment2String(std::string &pStr);
}
#endif  // OPENCOS_ORDER_COMMENT_H
